package procilege.test.pal;

import static junit.framework.Assert.assertEquals;

import org.junit.Assert;
import org.junit.Test;

import procilege.impl.ComputationalEntityMgr;

import com.google.inject.Inject;

public class ComputationalEntityMgrTest1 extends AbstractPalTest {

	@Inject
	protected ComputationalEntityMgr cem;

	@Test
	public void test1() {

		def(nn("p1"), pvm(nn("a")));
		dumpHistory(0, 30);
		printExpr(cem.retrievePrivlegeExpr(nn("p1")));
		printExpr(pvm(nn("a")));
		Assert.assertTrue(pvm(nn("a")).equals(pvm(nn("a"))));
		assertEquals(pvm(nn("a")), cem.retrievePrivlegeExpr(nn("p1")));

		def(nn("p1"), pvm(nn("b")));
		dumpHistory(0, 30);
		assertEquals(pvm(nn("b")), cem.retrievePrivlegeExpr(nn("p1")));

		def(nn("p2"), pvm(nn("c")));
		dumpHistory(0, 30);
		assertEquals(pvm(nn("c")), cem.retrievePrivlegeExpr(nn("p2")));

		def(nn("p1"), pvm(nn("d")));
		dumpHistory(0, 30);
		assertEquals(pvm(nn("d")), cem.retrievePrivlegeExpr(nn("p1")));
	}
}